<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class RentHouse extends Model
{
    use HasFactory;
    use HasDateTimeFormatter;
    use SoftDeletes;

    protected $guarded = [];
    protected $table = 'rent_house';

    public function wxUser()
    {
        return $this->belongsTo(WxUser::class, 'user_id');
    }

    public static function getRentData($where)
    {
        return self::with('wxUser')->where('type', 1)->where($where)->orderBy('created_at','desc')->get();
    }
}
